package config
{
    import mx.utils.StringUtil;

    import proto.client.SexType;

    public class Path
    {
        public static const RESOURCES_DIR:String = 'resources/';
        public static const ITEM_DIR:String = RESOURCES_DIR + 'items/';
        public static const ROOM_DIR:String = RESOURCES_DIR + 'room/';

        public function Path()
        {
        }

        public static function getItemResPath(id:uint):String
        {
            return ITEM_DIR + id + ".png";
        }

        public static function getDefaultActionImage(sex:uint , type:uint):String
        {
            return StringUtil.substitute ("resources/action/{0}/{1}.png" , sex , type);
        }

        public static function parseUrl(s:String):String
        {
            return StringUtil.substitute ("http://p229.shijie2.com/upload/render/{0}/{1}/{2}/{3}/{4}.png" , s.substr (0 , 2) , s.substr (2 , 1) , s.substr (3 , 3) , s.substr (3 , 6) , s);
        }

        public static function getRoomResPath(id:uint):String
        {
            return ROOM_DIR + id + ".png";
        }

        public static function getPhotoResPath(id:String):String
        {
            return "http://192.168.5.216/upload/album/" + id.substr (0 , id.length - 6) + "/" + id.substr (0 , id.length - 3) + "/" + id + ".jpg";
        }

        public static function getSmallPhotoResPath(id:String):String
        {
            return "http://192.168.5.216/upload/album/" + id.substr (0 , id.length - 6) + "/" + id.substr (0 , id.length - 3) + "/" + id + "_mini.jpg";
        }

        public static function getDefaultHeadImgBySex(sex:int):String
        {
            return StringUtil.substitute ("resources/head/{0}.png" , sex);
        }
    }
}
